package com.zzl.bonds.ticket.service.common.impl;

import com.zzl.bonds.ticket.constant.type.OperateButtonEnum;
import com.zzl.bonds.ticket.dto.KeyValue;
import com.zzl.bonds.ticket.service.common.TicketSignHandStatusService;
import com.zzl.bonds.ticket.untils.TicketUtils;
import com.zzl.general.common.exception.SysException;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : spp
 * @date : 2022/2/23 14:57
 */
@Service
public class TicketSignHandStatusServiceImpl implements TicketSignHandStatusService {
    /**
     * 设置签收的 操作
     *
     * @param ticketList 票据集合
     * @throws SysException 异常
     */
    @Override
    public void setTicketSignOperates(List<?> ticketList) throws SysException {
        if (CollectionUtils.isEmpty(ticketList)) {
            return;
        }
        for (Object ticket : ticketList) {
            List<KeyValue> keyValues = new ArrayList<>();
            KeyValue keyValue = new KeyValue(OperateButtonEnum.SIGN.getCode(), OperateButtonEnum.SIGN.getValue());
            keyValues.add(keyValue);
            TicketUtils.setOperateButton(ticket, keyValues);
        }
    }
}
